﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DotaHelp.Helpers;
using DotaHelp.Models;


namespace DotaHelp.Controllers
{
    
    public class SkillsController : Controller
    {       
        DotaModel model = new DotaModel();

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            model.Dispose();
            
        }

        [ChildActionOnly]
        public ActionResult One(int id)
        {
            var skill = model.Skills.FirstOrDefault(s => s.Id == id);
            return skill != null ? (ActionResult)PartialView(skill) : new ContentResult() { Content = "s" + id };
        }

        public ActionResult List()
        {
            return View(model.Skills.ToArray());
            
        }

        [Sitemap(typeof(Skill))]
        public ActionResult Details(int id)
        {
			var skill = model.Skills.Include("Hero").Include("Parents").Include("Child").First(s => s.Id == id);
           
            return View(skill);
        }


        public ActionResult Title(int id)
        {
            return PartialView(model.Skills.Include("Hero").Include("Parents").Include("Child").First(s => s.Id == id));
        }
    }
}
